using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Management;
using System.Net;
using System.Security.Principal;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace csharpsysinfo
{
    public partial class cSharpSysInfoForm : Form
    {
        string ipAddressString;

        public cSharpSysInfoForm()
        {
            

            string wMessageString, wErrorCodeString, wNativeErrorCodeString, wStackTraceString,
                   wSourceString, wGetBaseExceptionString, eMessageString;
            try
            {
                InitializeComponent();

            }
            catch (Win32Exception w)
            {
                
                //debug code to get the initial exception which ended up being
                //caused by an improper machine name being loaded, this is fixed
                //on form load however the message will still be here when the program
                //is run so we just use an empty catch statement to bypass it

                //Exception e = w.GetBaseException();
                //wMessageString = w.Message.ToString();
                //wErrorCodeString = w.ErrorCode.ToString();
                //wNativeErrorCodeString = w.NativeErrorCode.ToString();
                //wStackTraceString = w.StackTrace.ToString();
                //wSourceString = w.Source.ToString();
                //eMessageString = e.Message.ToString();

                //MessageBox.Show("Error Code" + wMessageString + wErrorCodeString + wNativeErrorCodeString + wStackTraceString + wSourceString + eMessageString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            
            }
            
            }


        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox1 aboutbox1 = new AboutBox1();
            aboutbox1.ShowDialog();
        }

        private void memoryUsageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            memoryUsageForm memoryusageform = new memoryUsageForm();
            memoryusageform.ShowDialog();
        }

        private void mountedFilesystemsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            mountedFileSystemsForm mountedfilesystemsform = new mountedFileSystemsForm();
            mountedfilesystemsform.ShowDialog();
        }

        private void networkUsageGroupBox_Enter(object sender, EventArgs e)
        {

        }

        private string GetMacAddress()
        {

            ManagementClass managementClass1 = new ManagementClass("Win32_NetworkAdapterConfiguration");
            ManagementObjectCollection managementObjectCollection1 = managementClass1.GetInstances();
            string address = string.Empty;

            foreach (ManagementObject obj in managementObjectCollection1)
            {
                if (address == String.Empty)
                {
                    if ((bool)obj["IPEnabled"] == true) address = obj["MacAddress"].ToString();
                }
                obj.Dispose();
            }
            //address = address.Replace(":", "");
            return address;


        }

        private string GetIpAddress()
        {
            //string ipAddressString = string.Empty;
            //get the host ip
            //this first line would be for ipv6
            //IPHostEntry IPHost = Dns.GetHostEntry(Dns.GetHostName());
            //this next line is for ipv4 but is obsoleted 
            IPHostEntry IPHost = Dns.GetHostByName(Dns.GetHostName());
            ipAddressString = IPHost.AddressList[0].ToString();
            return ipAddressString;
        }

        private string GetHostName()
        {
            string myHostName = Environment.MachineName;
            return myHostName;
        }

        private string GetWindowsVersion()
        {
            System.OperatingSystem osInfo = System.Environment.OSVersion;
            string myWindowsVersion = osInfo.ToString();
            return myWindowsVersion;
        }

        public TimeSpan GetSystemUpTime()
        {

            PerformanceCounter upTime = new PerformanceCounter("System", "System Up Time");
            upTime.NextValue();
            return TimeSpan.FromSeconds(upTime.NextValue());

        }

        private string GetCurrentUserName()
        {
            string windowsUsernameString = WindowsIdentity.GetCurrent().Name.ToString();
            return windowsUsernameString;


        }

        private string GetCpu0Value()
        {
            //maybe change this to wmi in the future Win32_Processor MaxClockSpeed

            string maxCpuSpeedString;

            maxCpuSpeedString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_Processor");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                maxCpuSpeedString = mob.Properties["MaxClockSpeed"].Value.ToString();
            }

            return maxCpuSpeedString;
            //RegistryKey OurKey = Registry.LocalMachine;
            //OurKey = OurKey.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0\", true);
            //string OurKey1 = OurKey.GetValue("~MHz").ToString();
            //return OurKey1;
        }

        //private string GetCpu1Value()
        //{
        //    RegistryKey OurKey = Registry.LocalMachine;
        //    OurKey = OurKey.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\1\", true);
        //    string OurKey1 = OurKey.GetValue("~MHz").ToString();
        //    return OurKey1;
        //}

        private string GetCpuName()
        {
            string cpuNameString;

            cpuNameString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_Processor");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                cpuNameString = mob.Properties["Name"].Value.ToString();
            }

            return cpuNameString;
            //RegistryKey OurKey = Registry.LocalMachine;
            //OurKey = OurKey.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0\", true);
            //string OurKey1 = OurKey.GetValue("ProcessorNameString").ToString();
            //return OurKey1;
        }

        private string GetCpuModel()
        {
            string cpuModelString;

            cpuModelString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_Processor");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                cpuModelString = mob.Properties["Caption"].Value.ToString();
                //UniqueId or ProcessorId instead of Caption?
            }

            return cpuModelString;
            //RegistryKey OurKey = Registry.LocalMachine;
            //OurKey = OurKey.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0\", true);
            //string OurKey1 = OurKey.GetValue("Identifier").ToString();
            //return OurKey1;
        }

        private string GetCpuVendor()
        {
            string cpuVendorString;

            cpuVendorString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_Processor");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                cpuVendorString = mob.Properties["Manufacturer"].Value.ToString();
            }

            return cpuVendorString;
            //RegistryKey OurKey = Registry.LocalMachine;
            //OurKey = OurKey.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0\", true);
            //string OurKey1 = OurKey.GetValue("VendorIdentifier").ToString();
            //return OurKey1;
        }

        private string GetCacheSize()
        {
            string cacheSizeString;

            cacheSizeString = "Failed to retrieve info.";
            
            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT L2CacheSize FROM  Win32_Processor");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                cacheSizeString = mob.Properties["L2CacheSize"].Value.ToString();
            }

            return cacheSizeString;

        } 

        private string GetL3CacheSize()
        {
            string l3CacheSizeString;

            l3CacheSizeString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT L2CacheSize FROM  Win32_Processor");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                l3CacheSizeString = mob.Properties["L2CacheSize"].Value.ToString();
            }

            return l3CacheSizeString;

        }
        private string GetNumberOfProcs()
        {
            string numberOfProcsString = Environment.ProcessorCount.ToString();
            return numberOfProcsString;
        }

        private string GetBiosInfo()
        {
            string biosString;

            biosString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_BIOS");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                biosString = mob.Properties["Manufacturer"].Value.ToString();
            }

            return biosString;

        }

        private string GetBiosSmVersion()
        {
            string biosSmVersionString;

            biosSmVersionString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_BIOS");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                biosSmVersionString = mob.Properties["SMBIOSBIOSVersion"].Value.ToString();
            }

            return biosSmVersionString;

        }
        private string GetBiosVersion()
                {
            string biosVersionString;

            biosVersionString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_BIOS");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                biosVersionString = mob.Properties["Version"].Value.ToString();
            }

            return biosVersionString;

        }

        private string GetBiosId()
        {
            string biosIdString;

            biosIdString = "Failed to retrieve info.";
            try
            {
                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_BIOS");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    biosIdString = mob.Properties["IdentificationCode"].Value.ToString();
                }
            }
            catch
            {
            }
            return biosIdString;

        }

        private string GetBiosSerial()
        {
            string biosSerialString;

            biosSerialString = "Failed to retrieve info.";
            try
            {
                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_BIOS");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    biosSerialString = mob.Properties["SerialNumber"].Value.ToString();
                }
            }
            catch
            {
            }
            return biosSerialString;

        }

        private string GetBiosReleaseDate()
        {
            string biosReleaseDateString;

            biosReleaseDateString = "Failed to retrieve info.";

            try
            {

                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_BIOS");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    biosReleaseDateString = mob.Properties["ReleaseDate"].Value.ToString();
                }
            }
            catch
            {
            }
            return biosReleaseDateString;

        }
        private string GetMotherboard()
        {
            string motherboardString;

            motherboardString = "Failed to retrieve info.";

            ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
            ("SELECT * FROM  Win32_BaseBoard");

            ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

            foreach (ManagementObject mob in managementobjectcollection)
            {
                motherboardString = mob.Properties["Manufacturer"].Value.ToString();
            }

            return motherboardString;

        }

        private string GetMotherboardModel()
        {
            string motherboardModelString;

            motherboardModelString = "Failed to retrieve info.";

            try
            {
                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_BaseBoard");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    motherboardModelString = mob.Properties["Model"].Value.ToString();
                }
            }
            catch 
            {
            }
            return motherboardModelString;

        }

        private string GetMotherboardName()
        {
            string motherboardNameString;

            motherboardNameString = "Failed to retrieve info.";

            try
            {
                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_BaseBoard");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    motherboardNameString = mob.Properties["Name"].Value.ToString();
                }
            }
            catch
            {
            }
            return motherboardNameString;

        }

        private string GetMotherboardSerial()
        {
            string motherboardSerialString;

            motherboardSerialString = "Failed to retrieve info.";

            try
            {
                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_BaseBoard");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    motherboardSerialString = mob.Properties["SerialNumber"].Value.ToString();
                }
            }
            catch
            {
            }
            return motherboardSerialString;

        }
        private string GetVideoController()
        {
            string videoControllerString;

            videoControllerString = "Failed to retrieve info.";

            try
            {
                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_VideoController");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    videoControllerString = mob.Properties["Name"].Value.ToString();
                }
            }
            catch
            {
            }
            return videoControllerString;

        }

        private string GetVideoControllerDriverVersion()
        {
            string videoControllerDriverVersionString;


            videoControllerDriverVersionString = "Failed to retrieve info.";

            try
            {
                ManagementObjectSearcher managementobjectsearcher = new ManagementObjectSearcher
                ("SELECT * FROM  Win32_VideoController");

                ManagementObjectCollection managementobjectcollection = managementobjectsearcher.Get();

                foreach (ManagementObject mob in managementobjectcollection)
                {
                    videoControllerDriverVersionString = mob.Properties["DriverVersion"].Value.ToString();
                }
            }
            catch
            {
            }
            return videoControllerDriverVersionString;

        }




        private void cSharpSysInfoForm_Load(object sender, EventArgs e)
        {
            int numberOfProcsInteger;

            //this fixes the initial exception error for path not found, we have to
            //set the machine name to that of the local machine
            performanceCounter1.MachineName = Environment.MachineName;
            performanceCounterCurrFreqProc0.MachineName = Environment.MachineName;
            performanceCounterCurrFreqProc1.MachineName = Environment.MachineName;
            performanceCounterMaxFreqProc0.MachineName = Environment.MachineName;
            performanceCounterMaxFreqProc1.MachineName = Environment.MachineName;

            //start getting all the info
            
            //get the hostname
            try
            {
                GetHostName();
                hostnameTextBox.Text = GetHostName();
                //performanceCounter1.MachineName = hostnameTextBox.Text.ToString();
            }
            catch
            {
                MessageBox.Show("Error Code 1", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get the ip address
                GetIpAddress();
                listeningIpTextBox.Text = GetIpAddress();
            }
            catch
            {
                MessageBox.Show("Error Code 2", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get the mac address
                GetMacAddress();
                macAddressTextBox.Text = GetMacAddress();
            }
            catch
            {
                MessageBox.Show("Error Code 3", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get windows version
                GetWindowsVersion();
                distroNameTextBox.Text = GetWindowsVersion();
            }
            catch
            {
                MessageBox.Show("Error Code 4", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get system uptime
                GetSystemUpTime();
                GetSystemUpTime();
                systemUptimeTextBox.Text = GetSystemUpTime().ToString();
            }
            catch
            {
                MessageBox.Show("Error Code 5", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get current username
                GetCurrentUserName();
                currentUserTextBox.Text = GetCurrentUserName();
            }
            catch
            {
                MessageBox.Show("Error Code 6", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //get the current load average
            
            //loadAveragesTextBox.Text = performanceCounter1.NextValue().ToString();

            try
            {
                //gets the current speeds from performance counter in server explorer

                CurrFreqCpu0TextBox.Text = performanceCounterCurrFreqProc0.NextValue().ToString();
                CurrFreqCpu1TextBox.Text = performanceCounterCurrFreqProc1.NextValue().ToString();
            }
            catch
            {
                MessageBox.Show("Error Code 7", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

            //try
            //{
                //gets the max speed of processor 0
                //GetCpu0Value();
                //MaxFreqCpu0TextBox.Text = GetCpu0Value();

                //MaxFreqCpu1TextBox.Text = GetCpu0Value();
                //put it in cpu speed also
                //cpuSpeedTextBox.Text = GetCpu0Value();
            //}
            //catch
            //{
            //    MessageBox.Show("Error Code 8", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}

            //gets the max speed of processor 1 from registry
            //GetCpu1Value();
            //MaxFreqCpu1TextBox.Text = GetCpu1Value();

            try
            {
                //gets the name of processor 0
                GetCpuName();
                processorNameTextBox.Text = GetCpuName();
            }
            catch
            {
                MessageBox.Show("Error Code 9", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //gets the model of proc 0
                GetCpuModel();
                modelTextBox.Text = GetCpuModel();
            }
            catch
            {
                MessageBox.Show("Error Code 10", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //gets vendor info of proc 0
                GetCpuVendor();
                processorVendorTextBox.Text = GetCpuVendor();
            }
            catch
            {
                MessageBox.Show("Error Code 11", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get L2 cache size
                GetCacheSize();
                cacheSizeTextBox.Text = GetCacheSize();
            }
            catch
            {
                MessageBox.Show("Error Code 12", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get L3 cache size
                GetL3CacheSize();
                l3CacheTextBox.Text = GetL3CacheSize();
            }
            catch
            {
                MessageBox.Show("Error Code 13", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get number of processors
                GetNumberOfProcs();
                processorsTextBox.Text = GetNumberOfProcs();
                numberOfProcsInteger = int.Parse(GetNumberOfProcs());
                

                //gets the max speed of processor 0
                GetCpu0Value();
                MaxFreqCpu0TextBox.Text = GetCpu0Value();
                
                //if there is two processors put the same value in proc 2 box
                //dual processors would have to be the same anyway
                if (numberOfProcsInteger >= 2)
                {
                    MaxFreqCpu1TextBox.Text = GetCpu0Value();
                }
                    //put it in cpu speed also
                cpuSpeedTextBox.Text = GetCpu0Value();
            }
            catch
            {
                MessageBox.Show("Error Code 14", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //obsoleted
            //get network adapter information
            //GetNetworkAdapterInfo();
            //networkDeviceTextBox.Text = GetNetworkAdapterInfo();

            try
            {
                //get bios manufacturer
                GetBiosInfo();
                biosTextBox.Text = GetBiosInfo();
            }
            catch
            {
                MessageBox.Show("Error Code 15", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get bios smversion
                GetBiosSmVersion();
                biosSmVersionTextBox.Text = GetBiosSmVersion();
            }
            catch
            {
                MessageBox.Show("Error Code 16", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get bios version
                GetBiosVersion();
                biosVersionTextBox.Text = GetBiosVersion();
            }
            catch
            {
                MessageBox.Show("Error Code 17", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get bios id
                GetBiosId();
                biosIdTextBox.Text = GetBiosId();
            }
            catch
            {
                MessageBox.Show("Error Code 18", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get bios serial
                GetBiosSerial();
                biosSerialTextBox.Text = GetBiosSerial();
            }
            catch
            {
                MessageBox.Show("Error Code 19", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get bios release date
                GetBiosReleaseDate();
                biosDateTextBox.Text = GetBiosReleaseDate();
            }
            catch
            {
                MessageBox.Show("Error Code 20", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get motherboard manufacturer
                GetMotherboard();
                motherboardTextBox.Text = GetMotherboard();
            }
            catch
            {
                MessageBox.Show("Error Code 21", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get motherboard model
                GetMotherboardModel();
                motherboardModelTextBox.Text = GetMotherboardModel();
            }
            catch
            {
                MessageBox.Show("Error Code 22", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get motherboard name
                GetMotherboardName();
                motherboardNameTextBox.Text = GetMotherboardName();
            }
            catch
            {
                MessageBox.Show("Error Code 23", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get motherboard serial
                GetMotherboardSerial();
                motherboardSerialTextBox.Text = GetMotherboardSerial();
            }
            catch
            {
                MessageBox.Show("Error Code 24", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get video controller
                GetVideoController();
                videoCardTextBox.Text = GetVideoController();
            }
            catch
            {
                MessageBox.Show("Error Code 25", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                //get video controller driver version
                GetVideoControllerDriverVersion();
                videoCardDriverVersionTextBox.Text = GetVideoControllerDriverVersion();
            }
            catch
            {
                MessageBox.Show("Error Code 26", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


        }

        private void networkInforToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NetworkInfoForm networkinfoform = new NetworkInfoForm();
            networkinfoform.ShowDialog();
        }

        private void driveInformationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DrivesForm drivesform = new DrivesForm();
            drivesform.ShowDialog();
        }

        private void deviceInfomationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DevicesForm devicesform = new DevicesForm();
            devicesform.ShowDialog();

        }



    }
}